import com.sun.xml.internal.ws.model.wsdl.WSDLOutputImpl;

import java.util.Random;
import java.util.Scanner;

public class Test {

    public static int add(int a,int b) {
        return a+b;
    }

    public static int add(int a,int b,int c) {
        return a+b+c;
    }

    public static long add(long a,long b,long c) {
        return a+b+c;
    }

    public static double add(double d,double c) {
        return d+c;
    }

    public static long add(int a,long b) {
        return a+b;
    }

    public static long add(long a,int b) {
        return a+b;
    }

    public static void main(String[] args) {
        int x = 10;
        int y = 20;
        int ret = add(x,y);
        System.out.println(ret);

        double d1 = 10.5;
        double d2 = 12.5;
        double dd = add(d1,d2);
        System.out.println(dd);
        
    }
    public static int fac(int n) {
        int ret = 1;
        for (int i = 1; i <= n; i++) {
            ret *= i;
        }
        return ret;
    }
    public static int facSum(int n) {
        int sum = 0;
        for (int i = 1;i <= n; i++) {
            sum +=fac(i);
        }
        return sum;
    }
    public static void main18(String[] args) {
        int  ret = facSum(5);
        System.out.println(ret);
    }
    public static void main17(String[] args) {
        int n = 7;
        for (int i = 30;i >= 0;i -= 2) {
            System.out.print(((n >> i) & 1) + " ");
        }
        System.out.println();
        for (int i =31; i >= 1;i -= 2) {
            System.out.print(((n >> i) & 1 )+" ");
        }
    }
    public static void main16(String[] args) {
//        int n = 7;
//        int count = 0;
//        for (int i = 0; i < 31; i++) {
//            if(((n >> i) & 1) != 0 ) {
//                count++;
//            }
//        }
//        System.out.println(count);

        int n = -1;
        int count = 0;
        while (n != 0 ) {
            if((n & 1) != 0) {
                count++;
            }
            n = n >>> 1;
        }
        System.out.println(count);
    }
    public static void main15(String[] args) {
        for (int i = 1; i < 999999; i++) {
            int count = 0;
            int tmp = i;
            while (tmp != 0) {
                count++;
                tmp /= 10;
            }
            //i --> 0
            tmp = i; // tmp = 153
            int sum = 0;
            while (tmp != 0) {
                sum += Math.pow(tmp % 10,count);
                tmp /= 10;
            }
            if(i == sum) {
                System.out.println(i);
            }
        }
    }
    public static void main14(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int c = a % b;
        while (c != 0) {
            a = b;
            b = c;
            c = a % b;
        }
        System.out.println(b);
    }
    public static void main13(String[] args) {
        for(int i =1; i <= 9; i++) {
            for(int j = 1; j <= i; j++) {
                System.out.print(j+"*"+i+"="+(i*j)+" ");
            }
            System.out.println();
        }
    }
    public static int fun(int n) {
        if( n == 1 ) {
            return 1;
        }
        return n+fun(n-1);
    }
    public static void main12(String[] args) {
        System.out.println(fun(10));
    }
    public static void main11(String[] args) {
        Scanner scanner = new Scanner(System.in);
        //系统生成一个随机数
        Random random = new Random();
        int randNum = random.nextInt(100);//[0-100)
        while (true) {
            System.out.println("请输入你要猜的数字：");
            int num = scanner.nextInt();
            if(num < randNum) {
                System.out.println("猜小了！");
            }else if(num > randNum) {
                System.out.println("猜大了!");
            }else {
                System.out.println("猜对了！");
                break;
            }
        }
    }

    public static void main10(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while(scanner.hasNextLine()) {
            String name = scanner.nextLine();
            System.out.println(name);
        }
    }
    public static void main9(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入你的姓名：");
        //String name = scanner.nextLine();//读取一行
        String name = scanner.next();//遇到空格会结束
        System.out.println(name);
    }

    public static void main8(String[] args) {
        String str = "123";
        int val = Integer.parseInt(str);
        System.out.println(val+1);
        int a = 123;
        String str2 = String.valueOf(a);
        System.out.println(str2);
    }
    public static void main7(String[] args) {
        //同时修改同一个名称变量快捷键是shift+F6
//        int n = 5;
//        int ret = 1;
//        for (int i = 1; i <= n; i++) {
//            ret *= i;
//        }
//        System.out.println(ret);
        int sum = 0;
        for (int n = 1; n <= 5; n++) {
            int ret = 1;
            for (int i = 1; i <= n; i++) {
                ret *=i;
            }
            sum+=ret;
        }
        System.out.println(sum);
    }
    public static void main6(String[] args) {
        for (int k = 0; k < 10; k++) {
            System.out.print(k+ " ");
        }
    }
    public static void main5(String[] args) {
        //写一个代码 找到1-100之间 既能被3整除
        //也能被5整除的所有数字 要求使用break 或者 continue中的一个
        int i = 1;
        while(i <= 100) {
            if(i % 15 != 0) {
                i++;
                continue;
            }
            System.out.println(i);
            i++;
        }
    }
    public static void main4(String[] args) {
        int i = 1;
        while ( i <= 10) {
            if (i == 3) {
                break;
            }
            System.out.println(i);
            i++;
        }
    }
    public static void main3(String[] args) {
        int i = 1;
        int count = 0;
        while (i <= 100) {
            if(i / 10 == 9) {
                count++;
            }
            if(i % 10 == 9){
                count++;
            }
            i++;
        }
        System.out.println(count);
    }
    public static void main2(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int x = scanner.nextInt();
        int k = 0;
        while (k <= x) {
            int i = 2;
            boolean flag = false;
            while (i <= Math.sqrt(k)) {
                if (k % i == 0) {
                    flag = true;
                    break;
                }
                i++;
            }
            if (flag == false) {
                System.out.println(k + " 是素数 ");
            } else {
                System.out.println(k + " 不是素数 ");
            }
            k++;
        }
    }

    public static void main1(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int x = scanner.nextInt();
        int i = 2;
        while (i<=Math.sqrt(x)) {
            if(x % i == 0) {
                System.out.println(x+"不是素数!");
                return;
            }
            i++;
        }
        System.out.println(x+ "是素数");
    }
}
